package cnpm02.j2ee.group3.logic.dao.impl;

import java.util.Date;
import java.util.List;

import javax.ejb.Local;

import cnpm02.j2ee.group3.logic.dao.generic.AbstractEntityDao;
import cnpm02.j2ee.group3.model.City;
import cnpm02.j2ee.group3.model.Ticket;

@Local
public interface TicketDao extends AbstractEntityDao<Ticket> {
	final String SELECT_ALL_QUERY = "from Ticket order by price";
	final String SELECT_TICKET_BY_DATE_AND_CITY = "from Ticket t "
			+ "where t.flight.departDate >= :date1 and t.flight.departDate <= :date2 and t.soldQuantity<t.quantity "
			+ "and t.flight.flightLine.from = :from and t.flight.flightLine.to = :to order by t.flight.departDate";

	/**
	 * Select all tickets whose flight has depart date within date and date + 7
	 * @param date
	 * @param arriveDate Arrive Date
	 * @return {@link List} of {@link Ticket} found tickets
	 * */
	List<Ticket> selectWithinTicket(City from, City to, Date date);
}
